package TestPaperSystem.controller;


import TestPaperSystem.Dto.ExamDTO;
import TestPaperSystem.Dto.RepoVo;
import TestPaperSystem.entity.Repo;
import TestPaperSystem.service.RepoService;
import TestPaperSystem.utils.R;
import TestPaperSystem.utils.ResponseUtils_R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xwj
 * @since 2023-03-25
 */
@RestController
@RequestMapping("/repo")
public class RepoController {
    @Autowired
    RepoService repoService;

    @PostMapping("/save")
    public R add(@RequestBody Repo repo){
        return ResponseUtils_R.success(repoService.saveRepo(repo));
    }

    @PostMapping("/repoPage")
    public R repoPage(@RequestBody RepoVo page) throws Exception{
        return ResponseUtils_R.success(repoService.repoByUserId(page));

    }

    @PostMapping("/test")
    public R repoPage_test(@RequestBody ExamDTO examDTO){
        return ResponseUtils_R.success(examDTO);
    }
}

